約 3,243,261 件
https://w.atwiki.jp/yusa/
https://w.atwiki.jp/dmori/pages/18.html
Verilog HDL リファレンス BNF_1995BNF_SV31Ainsideシステム関数$display$random$readmemh__template__予約語構文__template__dist構造体 Tips $randomの罠(ネタ帳)BMPファイルの出力Ruby VPIruby-vpi_ugリファレンスVCSから波形ファイルを出力するVMM RALを使うVPI(PLI2.0)を使う__template__classを使うjoin_any,join_noneの注意点taskの引数の取得・更新タイミングカウンタキューを使った遅延バッファテキストログのカラー表示列挙型(enum)でループ動的なメモリの確保動的なメモリの確保時、同時に値をコピー平方根1汎用遅延素子汎用遅延素子2演算の精度配列をソートする(クイックソート)非同期乗換え1非同期乗換え:バス1 バグ事例 .pop_~と.sizeの併用__template__ メモ Veritak Cver用にVPIを書いてみた (2008-11-26 12 46 30) Veritakで算術ライブラリVPI (2008-11-26 12 48 47) VCSでVPI (2008-11-26 12 52 25) Verilog PLI Tutorial (1) (2008-11-26 12 57 48) Verilog PLI Tutorial (2) (2008-11-26 12 58 46) サイト名 URL 更新履歴 2012-02-27 言語/verilog/Tips/join_any,join_noneの注意点 2010-03-11 言語/verilog/Tips/非同期乗換え1 2009-02-24 言語/verilog/Tips/Ruby VPI/ruby-vpi_ug/リファレンス 言語/verilog/Tips/Ruby VPI/ruby-vpi_ug 言語/verilog/Tips/Ruby VPI 2009-02-04 言語/verilog/バグ事例/.pop_~と.sizeの併用 言語/verilog/バグ事例/__template__ 言語/verilog/バグ事例 2009-01-21 言語/verilog/Tips/VCSから波形ファイルを出力する 2009-01-08 言語/verilog/Tips/汎用遅延素子2
https://w.atwiki.jp/tech_memo/pages/24.html
Verilog Verilog文法 テストベンチ Modelsim Verilog小技集 このページを編集 上へ
https://w.atwiki.jp/bambooflow/pages/74.html
iverilog Icarus Verilog はフリーのHDLシミュレーションみたいです。 フリーでシミュレーションができるなんて、感動です。 インストール ここから最新版をダウンロードしてきます。 verilog-0.8.5.tar.gzをダウンロード。 $ tar xzf verilog-0.8.5.tar.gz $ cd verilog-0.8.5 $ ./configure --prefix=/usr/local $ make # make install このときmake実行時に下記のようなエラー発生しました。 ・・・ sys_lxt.c 24 から include されたファイル中 lxt_write.h 33 19 bzlib.h そのようなファイルやディレクトリはありません ・・・ このエラーに気づかないまま、make installを実行してシミュレーションを実行しようとしたら、以下のようなメッセージが出てしまいました。 system Unable to find a `system.vpi module on the search path. ここで、verilog-0.8.5/vpi/lxt_write.hの33行目をとりあえず、コメントアウトしました。 33 //#include bzlib.h 再び、make; make installを実行。 そうしたら、無事シミュレーションが実行できるようになりました。 実行 以下にADDERのサンプルを用意しました。 addr.tgz mod.v 加算器 tb.v テストベンチ コンパイルは次のとおり。 $ iverilog -o run tb.v mod.v すると、実行ファイル"run"が生成されます。 もし、"-o"を付けなかった場合、"a.out"が生成されます。 実行は次のとおり。 $ vvp run もしくは、./runでも実行できます。 実行すると、test.vcdファイルが生成されます。 test.vcdファイルをgtkwaveで確認してみました。 gtkwaveのインストールは、こちら?を参照してください。 参考ページ http //www.icarus.com/eda/verilog/ Icarus Verilog 謎掃き溜め
https://w.atwiki.jp/g8495625/pages/34.html
コマンド Verilog HDL Libc google(Verilog HDL) Verilog-HDL 入門 Verilog-HDL 演算子と代入文 Verilog-2001 Code Book アセンブラ コマンド GNU C/C++ コンパイラ コマンド アセンブラ コマンド
https://w.atwiki.jp/aroe/pages/16.html
Verilog HDL Tips もしくはドはまりした反省 レジスタのリセット Verilogの言語仕様では左辺が右辺より大きい場合、 自動的に左辺の幅に合わせて足りない分が0で拡張される。 それを利用してparameterでビット幅が変わるようなレジスタのリセット はとりあえず右辺に1'b0と書いておけばいい。 ex reg [3 0] a; a = 1 b0; //これで問題ない a = 0 //これだと右辺は32bitなので論理合成でWarnigが出る reg [4 0] b,c,d; {b,c,d} = 1 b0; //これも問題ない 条件演算子(セレクタ) assign a = (x)? b c; xが真なら左のWireを偽なら右のWireをアサインする センシティブ reg Register; always@(Register)begin (処理) end こんな感じでposedgeやらnegedgeを付けずにセンシティブを書くとシミュレーションの場合 リセット時の不定値から0になった場合でも起動してしまうので注意。 複数のセンシティブから同じレジスタに書き込んではいけない always@(posedge Clock or posedge Reset) begin if(Reset) begin Count = 0; end else begin Count = Count + 1 b1; end end always@(posedge AltClock) begin Count = Count + 1 b1; end 上記のような書き方はNG。 実際のハードウェア構成では書き込みクロックを二つもつことはできないので論理合成ではねられる。 複数のクロックから書き込みたい場合はMUXを使ってクロックを選択する センンシティブのクロックエッジは一つの信号につき一つにする always @(posedge Clock or negdgede Clock) begin 上記のように書くと論理合成でエラーが出る。これもやはりD型フリップフロップの構造に由来する。 ひとつの信号につきクロックエッジは上昇端か下降端どちらかにすること。 ビット指定 reg [7 0] Value; reg [2 0] Select; always@(posedge Value[Select]) 上のように書くと文法エラーになる。レジスタのビット指定は定数、 またはparameterで指定しなければいけない。 数値の2の補数表現 4 d1// = 4 b0001 -4 d1// = 4 b1111 4 sd1// = 4 b0001 -4 sd1// = 4 b1111 ANSI C スタイルのModuleの書きかた メリット ポート宣言とビット幅指定を一度に行えるのでコード量が減らせる defparamいらない デメリット Verilog2001以上でしか使えない 例. //モジュール定義例 module BitShifter #( parameter i = 4, //デフォルトのパラーメータ parameter s = 2 ) ( input [i-1 0] in, input [s-1 0] amt, output [i-1 0] result ); assign result = in amt; endmodule module tb_bs; reg [7 0] in; reg [2 0] amt; wire [7 0] result; //インスタン化宣言例 BitShifter #(.i(8),.s(3)) //パラーメータ上書き bs (.in(in),.amt(amt),.result(result)); //インスタンス宣言 endmodule
https://w.atwiki.jp/dmori/pages/12.html
Verilog HDL 1995 予約語(102) casex primitive repeat supply0 always casez event macromodule supply1 edge rnmos table else medium rpmos end initial rtran task and endcase inout module rtranif0 vectored input nand pull0 rtranif1 negedge pull1 scalared time cmos for pulldown wait assign endfunction force nmos pullup integer nor tran wand forever tranif0 weak0 begin fork not tranif1 weak1 endmodule join notif0 small while function notif1 tri endprimitive specify tri0 wire large or specparam tri1 highz0 output rcmos triand buf deassign highz1 real trior wor bufif0 default endspecify if realtime strong0 trireg xnor bufif1 defparam endtable parameter strong1 xor endtask ifnone pmos reg case disable posedge release verilog 2001 予約語(123) casex primitive repeat supply0 always casez event macromodule supply1 unsigned cell edge incdir rnmos table use else include medium rpmos end initial rtran task and endcase inout module rtranif0 vectored input nand pull0 rtranif1 negedge pull1 scalared time cmos endconfig for instance pulldown wait assign config endfunction force nmos pullup automatic endgenerate integer nor pulsestyle_ondetect tran wand forever noshowcancelled pulsestyle_onevent showcancelled tranif0 weak0 begin fork not signed tranif1 weak1 endmodule join notif0 small while function notif1 tri endprimitive generate specify tri0 wire genvar large or specparam tri1 highz0 liblist output rcmos triand buf deassign highz1 library real trior wor bufif0 default endspecify if realtime strong0 trireg xnor bufif1 defparam endtable localparam parameter strong1 xor design endtask ifnone pmos reg case disable posedge release SystemVerilog 3.0 予約語(166) casex enum longreal primitive repeat supply0 unique always casez do event import macromodule priority return supply1 unsigned always_comb cell edge incdir process rnmos table use always_ff else export include medium rpmos always_latch changed end initial modport rtran task and char endcase extern inout module rtranif0 vectored assert input nand pull0 rtranif1 assert_strobe negedge pull1 scalared time void cmos endconfig for instance pulldown timeprecision wait assign config endfunction force int nmos pullup shortint timeunit automatic const endgenerate integer nor pulsestyle_ondetect shortreal tran wand forever interface noshowcancelled pulsestyle_onevent showcancelled tranif0 weak0 begin endinterface fork not signed tranif1 weak1 continue endmodule forkjoin join notif0 small transition while function notif1 tri endprimitive generate specify tri0 wire bit genvar large or specparam tri1 break highz0 liblist output rcmos static triand buf deassign highz1 library real trior wor bufif0 default endspecify if packed realtime strong0 trireg xnor bufif1 defparam endtable iff localparam parameter strong1 type xor byte design endtask ifnone logic pmos reg struct typedef case disable endtransition longint posedge release union SystemVerilog 3.1 予約語(202) alias casex dist enum longreal primitive repeat supply0 unique always casez do event import macromodule priority return supply1 unsigned always_comb cell edge incdir process rnmos table use always_ff chandle else export include medium program rpmos always_latch changed end extends initial modport property rtran task var and char endcase extern inout module protected rtranif0 this vectored assert class endclass final input nand pull0 rtranif1 throughout virtual assert_strobe clocking endclocking first_match inside negedge pull1 scalared time void cmos endconfig for instance new pulldown sequence timeprecision wait assign config endfunction force int nmos pullup shortint timeunit wait_order automatic const endgenerate integer nor pulsestyle_ondetect shortreal tran wand before constraint forever interface noshowcancelled pulsestyle_onevent showcancelled tranif0 weak0 begin context endinterface fork intersect not pure signed tranif1 weak1 bind continue endmodule forkjoin join notif0 rand small transition while cover function join_any notif1 randc solve tri endprimitive generate join_none null specify tri0 wire bit endprogram genvar large or specparam tri1 with break endproperty highz0 liblist output rcmos static triand within buf deassign endsequence highz1 library real string trior wor bufif0 default endspecify if local packed realtime strong0 trireg xnor bufif1 defparam endtable iff localparam parameter ref strong1 type xor byte design endtask ifnone logic pmos reg struct typedef case disable endtransition longint posedge release super union SystemVerilog 3.1a 予約語(220) alias casex dist enum illegal_bins longreal primitive repeat supply0 unique always casez do event import macromodule priority return supply1 unsigned always_comb cell edge expect incdir matches process rnmos table use always_ff chandle else export include medium program rpmos tagged always_latch changed end extends initial modport property rtran task var and char endcase extern inout module protected rtranif0 this vectored assert class endclass final input nand pull0 rtranif1 throughout virtual assert_strobe clocking endclocking first_match inside negedge pull1 scalared time void assume cmos endconfig for instance new pulldown sequence timeprecision wait assign config endfunction force int nmos pullup shortint timeunit wait_order automatic const endgenerate foreach integer nor pulsestyle_ondetect shortreal tran wand before constraint endgroup forever interface noshowcancelled pulsestyle_onevent showcancelled tranif0 weak0 begin context endinterface fork intersect not pure signed tranif1 weak1 bind continue endmodule forkjoin join notif0 rand small transition while bins cover endpackage function join_any notif1 randc solve tri wildcard binsof covergroup endprimitive generate join_none null randcase specify tri0 wire bit coverpoint endprogram genvar large or randsequence specparam tri1 with break cross endproperty highz0 liblist output rcmos static triand within buf deassign endsequence highz1 library package real string trior wor bufif0 default endspecify if local packed realtime strong0 trireg xnor bufif1 defparam endtable iff localparam parameter ref strong1 type xor byte design endtask ifnone logic pmos reg struct typedef case disable endtransition ignore_bins longint posedge release super union IEEE Std. 1800-2005 予約語(221) SystemVerilog 3.1aにuwire が追加
https://w.atwiki.jp/dmori/pages/13.html
BNF_1995BNF_SV31Ainsideシステム関数$display$random$readmemh__template__予約語構文__template__dist構造体 リファレンスマニュアル(LRM) BNF verilog 1995 System verilog 3.1a 演算子 inside システム関数 link_pdfプラグインはご利用いただけなくなりました。 -
https://w.atwiki.jp/tech_memo/pages/25.html
Verilog文法 宣言文module 記述するモジュール名を定義する endmodule モジュールの最後を指定するもの input 入力信号の宣言 output 出力信号の宣言 inout 入出力信号 wire ワイヤー宣言 reg レジスタ宣言 parameter 定義値の宣言 include 外部ファイルの設定内容を読み込む場合に使用 演算assign wire文の演算を行う。(左辺は必ずwire文) always イベントが発生するごとに動作する if~else 条件選択(C言語と同じ) function 入力にあった出力を行う。原則wireと同様、値のみ返し値の保持は行わないcase 条件分岐(C言語のswitch文に相当する) その他結合 選択 その他情報ノンブロッキング文・ブロッキング文ブロッキング文(=) ノンブロッキング文( =) 宣言文 module 記述するモジュール名を定義する ex module foo(inA , inB , outC , outD); foo モジュール名 inA , inB 入力信号線名※ outC , outD 出力信号線名※ ※ここでは、2つ記述しているが入出力線の数に制限は無い endmodule モジュールの最後を指定するもの input 入力信号の宣言 ・入力が多ビット信号の場合は、以下のように表現する ・input[width - 1 0] inA; →ビット長がwidth[bit]の場合の宣言方法 ・モジュールの場合、wireとして内部で扱われる output 出力信号の宣言 ・多ビットの場合はinputと同様の形式で表現する ・モジュールの場合、regとして内部て扱われる inout 入出力信号 ・未だに一度も使ったことが無い wire ワイヤー宣言 ・信号線の名前の宣言 ・値を保持することができない →接続されているものの状態で常に変化する ・多ビットの場合はinputと同様の形式で表現する reg レジスタ宣言 ・レジスタの名前の宣言 ・値を保持することが可能 ・ロジックの消費が多い ・多ビットの場合はinputと同様の形式で表現する parameter 定義値の宣言 ・C言語での#defineと同等の働きをする include 外部ファイルの設定内容を読み込む場合に使用 ex 同一フォルダ内のhogehoge.vhを読み込むとする → inclide "./hogehoge.vh" 演算 Verilog-HDLは、記述した内容が並列で動作する。そのため、演算の内容の集合(関数のようなもの)の範囲を明示するために以下の表現を用いる この表現で明示された内容をひとまとまりとして考える。 assign wire文の演算を行う。(左辺は必ずwire文) 左辺のwire文の内容を示すために、右辺でreg文が必要になった場合にはreg文も使用可能 always イベントが発生するごとに動作する 記述方法→always@(…) …には以下の3つの表現方法がある ・posedge:信号の立ち上がりに同期 ・negedge:信号の立ち下りに同期 ・なし:信号が変化したときに同期 ※これらの表現やイネーブル信号をandやorで組み合わせることができる if~else 条件選択(C言語と同じ) ・if文は上から順に条件比較を行う。そのため、多段になる場合はfunction文への書き換えを検討する function 入力にあった出力を行う。原則wireと同様、値のみ返し値の保持は行わない 文法 function[width - 1 0] function名 input[widthA - 1 0] inA; input[widthB - 1 0] inB; //計算内容 endfunction 呼び出し方法 assign Wire名 = function名(A , B) →function内のinAにAが、inBにBが代入される case 条件分岐(C言語のswitch文に相当する) 文法 case(条件) 条件1: 条件2: … default endcase その他 あとは思いつくものをつらつらと 結合 複数の信号線から一つの信号線を作成。または、信号線のビット位置の並べ替えを行う ex 1.assign hoge = {foo[2 1] , bar[3 0] , foo[5]} →fooの2,3ビット目、barの1から4ビット目、fooの6ビット目の順で結合 2.assign {Co , add} = inA + inB + Cin; →加算器のようなもの(桁上がりがCoに代入される) 3.assign hoge = {4{2 b01}};→「8 b0101_0101」 →"01"の並びのデータが4つ続く 選択 多ビット信号線から並んでいる1ビット以上の信号を選択する ex 信号線hogeのmビット目からnビット目までを選択する →hoge[n - 1 m - 1] その他情報 ノンブロッキング文・ブロッキング文 言葉で書くと難しいので結果を書いてみる レジスタ: regA:「初期値をしてhogeが入っているとする」 regB ブロッキング文(=) regA = bar; regB = regA; →regA、regB共にbarの値が代入される ノンブロッキング文( =) regA = bar; regB = regA; →regAにはbarが代入され、regBにはhogeが代入される これは、読み出しの順番によって起こる違い ブロッキング文はC言語と同様に上から順に演算が行われていく。一方、ノンブロッキング文は 右辺の読み出しを最初に行い、その後代入を行うため信号変化の前の値が代入される。 ※レジスタを扱うときは、特別なことが無い限りノンブロッキング文を使ったほうがいい。 このページを編集 上へ
https://w.atwiki.jp/dominion/pages/15.html
Icarus Verilogのインストール方法について解説しています。 Icarus Verilogのインストール方法 Icarus Verilogのインストール確認方法 Icarus Verilogのインストール方法 1. このページにアクセスして、Windows版Icarus Verilogをダウンロードします。 2008年10月14日時点の最新安定版は0.8.6です。 2. ダウンロードしたiverilog-X.Y.Z_setup.exeを実行します。 下図のような画面が表示されるので、Nextをクリックします。 3. ライセンスについて表示されます。 I accept the agreementを選択し、Nextをクリックします。 4. Icarus Verilogをインストールするディレクトリについて聞かれます。 デフォルトはC \Program Files以下のディレクトリ名になっていますが、ディレクトリ名に空白が入っていると後でトラブルになる可能性が高いです。 C \icarusなどのように、空白を含まないディレクトリ名に変更しておくことを強く推奨します。 5. スタートメニューへの登録名について聞かれます。 Nextをクリックします。 6. デスクトップにIcarus Verilog用のアイコンを作るか聞かれます。 作りたくない場合は、チェックをはずしてください。 Nextをクリックします。 7. インストールの設定について表示されます。 問題がないか確認して、Installをクリックします。 8. インストールが終了すると、下記のように表示されます。 Icarus Verilogの実行ディレクトリを環境変数PATHに追加しておくと便利なので、チェックはしたままにしておいてください。 Finishをクリックして、インストールを終了します。 Icarus Verilogのインストール確認方法 1. コマンドプロンプトを立ち上げ、Icarus Verilogをインストールしたディレクトリに移動します。 2. コマンドプロンプトで、下記のように入力してください。 hello.vlというテストベンチをコンパイルし、helloという実行ファイルを作成します。 C \icarus iverilog -o hello hello.vl 3. コマンドプロンプトで、下記のように入力してください。 C \icarus vvp hello 下記のようにHello, Worldと表示されればOKです。